# -*- coding: utf-8 -*-

import smtplib
from email.mime.text import MIMEText

fromaddr = "gongqf@ndtv.com.cn"
toaddrs  = "gongqf@ndtv.com.cn"
subject=u"测试".encode("gb2312")

# Add the From: and To: headers at the start!
msg = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n"
       % (fromaddr, toaddrs,subject))
msg = msg + u"abcd测试".encode("gb2312")

print "Message length is " + repr(len(msg))

server = smtplib.SMTP('mail.ndtv.com.cn')
server.set_debuglevel(1)
server.login("gongqf","118103")
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
